<?php

/* @var $this yii\web\View */
use yii\helpers\Html;

$this->title = '销售情况';
$this->params['breadcrumbs'][] = $this->title;
?>
<?= Html::jsFile('@web/js/echarts.min.js') ?>
<div class="site-sale">
    <div id="main" style="height: 400%;width: 100%;">

    </div>
</div>
<?php $this->beginBlock('myjs') ?>
var myChart = echarts.init(document.getElementById('main'));
myChart.showLoading();
$.ajax({
url: '<?=\Yii::getAlias('@web')?>/predict/ajaxsale?airline=<?=$airline?>',
type: 'get',
dataType: 'json',
success: function (data)
{
myChart.hideLoading();
var option = {
title : {
text: '<?=$airline?>销售情况',
},
tooltip : {
trigger: 'axis'
},
legend: {
data:['销售额','销售量']
},
toolbox: {
show : true,
feature : {
dataView : {show: true, readOnly: true},
magicType : {show: true, type: ['line', 'bar']},
saveAsImage : {show: true}
}
},
calculable : true,
xAxis : [
{
type : 'category',
data : data.X
}
],
yAxis : [
{
type : 'value'
}
],
series : [
{
name:'销售额',
type:'bar',
data:data.mY,
markLine : {
data : [
{type : 'average', name: '平均值'}
]
}
},
{
name:'销售量',
type:'bar',
data:data.cY,
markLine : {
data : [
{type : 'average', name : '平均值'}
]
}
}
]
};
myChart.setOption(option);
}
});
<?php $this->endBlock() ?>
<?php $this->registerJs($this->blocks['myjs'], \yii\web\View::POS_READY); ?>
